﻿/**
 * The AudioTrack Library by Chris J. Rock. Aug 10, 2011
 * Check out chrisjrock.net and be a king among men.
 *
 * Copyright (c) 2011 Chris J. Rock
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 **/


package net.chrisjrock.sound.audioTrack.events 
{
	import flash.events.Event;
	
	/**
	 * Used for all track events.
	 * @author Christopher J. Rock
	 */
	public class AudioTrackEvent extends Event 
	{
		/**
		 * Dispatched when a track's input fails to load. 
		 */		
		public static const IO_ERROR:String = "audioTrackIOError";
		
		/**
		 * Dispatched as a track's load progresses. 
		 */		
		public static const PROGRESS:String = "audioTrackProgress";
		
		/**
		 * Dispatched upon track load completion. 
		 */		
		public static const LOAD_COMPLETE:String = "audioTrackLoadComplete";
		
		/**
		 *  Dispatched whenever a track is played.
		 */		
		public static const PLAY:String = "audioTrackPlay";
		
		/**
		 * Dispatched whenever a track is stopped. 
		 */		
		public static const STOP:String = "audioTrackStop";
		
		/**
		 * Dispatched whenever a track is paused. 
		 */		
		public static const PAUSE:String = "audioTrackPause";
		
		/**
		 * Dispatched whenever a track is scrubbed. 
		 */		
		public static const SCRUB:String = "audioTrackScrub";
		
		/**
		 * Dispatched when a track's playhead moves to the start position from any other position. 
		 */		
		public static const AT_START:String = "audioTrackAtStart";
		
		/**
		 * Dispatched when a track's playhead leaves the start position. 
		 */		
		public static const LEAVE_START:String = "audioTrackLeaveStart";
		
		/**
		 * Dispatched when a track's playhead reaches the track's end from any other positon. 
		 */		
		public static const AT_END:String = "audioTrackAtEnd";
		
		/**
		 * Dispatched when a track's playhead leaves the end position. 
		 */		
		public static const LEAVE_END:String = "audioTrackLeaveEnd";
		
		/**
		 * Dispatched when a track's mute status is toggled. 
		 */		
		public static const MUTE_TOGGLE:String = "audioTrackMuteToggle";
		
		/**
		 * Dispatched when a track's solo status is toggled. 
		 */		
		public static const SOLO_TOGGLE:String = "audioTrackSoloToggle";
		
		/**
		 * Dispatched by any ISequenceTrack when a change is made to the sequence. NOTE: Not yet implemented.
		 */		
		public static const SEQUENCE_UPDATE:String = "sequenceUpdate"; //TODO: Implement this on changes in duration and other sequence properties.
		
		public function AudioTrackEvent(type:String , bubbles:Boolean = false , cancelable:Boolean = false)
		{
			super(type , bubbles , cancelable);
		}
		
		/**
		 * Returns a duplicate object.
		 * @return 
		 */		
		public override function clone():Event
		{
			return new AudioTrackEvent(type , bubbles , cancelable);
		}
		
		public override function toString():String
		{
			return formatToString("AudioTrackEvent", "type", "bubbles", "cancelable", "eventPhase");
		}
	}
	
}